package com.ruoyi.waterManagement.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.core.domain.business.waterManagement.WrManstatR;
import com.ruoyi.waterManagement.service.IWrManstatRService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 水量人工观测站数据记录Controller
 * 
 * @author hwd
 * @date 2023-02-21
 */
@RestController
@RequestMapping("/WrManstatR")
public class WrManstatRController extends BaseController
{
    @Autowired
    private IWrManstatRService wrManstatRService;

    /**
     * 查询水量人工观测站数据记录列表
     */
    @RequiresPermissions("waterManagement:WrManstatR:list")
    @GetMapping("/list")
    public TableDataInfo list(WrManstatR wrManstatR)
    {
        startPage();
        List<WrManstatR> list = wrManstatRService.selectWrManstatRList(wrManstatR);
        return getDataTable(list);
    }

    /**
     * 导出水量人工观测站数据记录列表
     */
    @RequiresPermissions("waterManagement:WrManstatR:export")
    @Log(title = "水量人工观测站数据记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WrManstatR wrManstatR)
    {
        List<WrManstatR> list = wrManstatRService.selectWrManstatRList(wrManstatR);
        ExcelUtil<WrManstatR> util = new ExcelUtil<WrManstatR>(WrManstatR.class);
        util.exportExcel(response, list, "水量人工观测站数据记录数据");
    }

    /**
     * 获取水量人工观测站数据记录详细信息
     */
    @RequiresPermissions("waterManagement:WrManstatR:query")
    @GetMapping(value = "/{statCd}")
    public AjaxResult getInfo(@PathVariable("statCd") String statCd)
    {
        return success(wrManstatRService.selectWrManstatRByStatCd(statCd));
    }

    /**
     * 新增水量人工观测站数据记录
     */
    @RequiresPermissions("waterManagement:WrManstatR:add")
    @Log(title = "水量人工观测站数据记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WrManstatR wrManstatR)
    {
        return toAjax(wrManstatRService.insertWrManstatR(wrManstatR));
    }

    /**
     * 修改水量人工观测站数据记录
     */
    @RequiresPermissions("waterManagement:WrManstatR:edit")
    @Log(title = "水量人工观测站数据记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WrManstatR wrManstatR)
    {
        return toAjax(wrManstatRService.updateWrManstatR(wrManstatR));
    }

    /**
     * 删除水量人工观测站数据记录
     */
    @RequiresPermissions("waterManagement:WrManstatR:remove")
    @Log(title = "水量人工观测站数据记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{statCds}")
    public AjaxResult remove(@PathVariable String[] statCds)
    {
        return toAjax(wrManstatRService.deleteWrManstatRByStatCds(statCds));
    }
}
